Skip to content

Conversation

@miri64
Copy link
Member

@miri64 miri64 commented Feb 19, 2014

No description provided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've allowed myself to smuggle in this little change, since #576 seemed to forgot about that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make a PR on its own out of that diff, then we can fast track it.
Maybe you could add spaces in the next line, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎 (from @mehlis)

@miri64
Copy link
Member Author

miri64 commented Feb 19, 2014

Here's a somewhat nicer overview of what I've changed from libcoap upstream:

git clone git://github.com/authmillenon/libcoap
git log --oneline --stat origin/master...origin/riot-port
31a9bc1 Eliminate some compiler warnings and errors
 address.h | 4 ++++
 net.c     | 4 ++++
 net.h     | 8 +++++---
 3 files changed, 13 insertions(+), 3 deletions(-)
926db19 Remove two example programs in root
 coap-observer.c | 185 ----------------------------------------------
 coap-server.c   | 220 -------------------------------------------------------
 2 files changed, 405 deletions(-)
8516e60 Add config.h
 config.h | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)
0c58dfa Add RIOT Makefile
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)
git show --oneline 0c58dfa
0c58dfa Add RIOT Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f90baa1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,5 @@
+MODULE:=$(shell basename $(CURDIR))
+INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include
+CFLAGS += -DWITH_POSIX
+
+include $(RIOTBASE)/Makefile.base
git show --oneline 31a9bc1
[martin@beutlin libcoap]<3 cat pla. 
31a9bc1 Eliminate some compiler warnings and errors
diff --git a/address.h b/address.h
index 403240e..0e715f1 100644
--- a/address.h
+++ b/address.h
@@ -106,6 +106,10 @@ _coap_address_equals_impl(const coap_address_t *a,
  return 0;
 }

+#ifndef IN_MULTICAST
+#define IN_MULTICAST(a) (1)
+#endif
+
 static inline int
 _coap_is_mcast_impl(const coap_address_t *a) {
   if (!a)
diff --git a/net.c b/net.c
index e90d49a..f4b3b67 100644
--- a/net.c
+++ b/net.c
@@ -45,6 +45,10 @@
 #include "block.h"
 #include "net.h"

+#ifndef UINT_MAX
+#define UINT_MAX    ((2 << sizeof (unsigned)) - 1)
+#endif
+
 #if defined(WITH_POSIX)

 time_t clock_offset;
diff --git a/net.h b/net.h
index f9afd48..59c7d59 100644
--- a/net.h
+++ b/net.h
@@ -132,7 +132,7 @@ typedef struct coap_context_t {
    * random value. A new message id can be created with
    * coap_new_message_id().
    */ 
-  unsigned short message_id;
+  uint16_t message_id;

   /**
    * The next value to be used for Observe. This field is global for
@@ -196,9 +196,11 @@ coap_context_t *coap_new_context(const coap_address_t *listen_addr);
 static inline unsigned short 
 coap_new_message_id(coap_context_t *context) {
 #ifndef WITH_CONTIKI
-  return htons(++(context->message_id));
+    context->message_id += 1;
+    return htons(context->message_id);
 #else /* WITH_CONTIKI */
-  return uip_htons(++context->message_id);
+    context->message_id += 1;
+    return uip_htons(context->message_id);
 #endif
 }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an IPv4 function. Since RIOT does not support that: always be true.

@Kijewski
Copy link
Contributor

#define UINT_MAX ((2 << sizeof (unsigned)) - 1)
2 << x equals 4**x, and sizeof (unsigned) == 4 (for example), not 32.

Just use sizeof #define UINT_MAX ((unsigned) -1ul).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do need really this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise the compiler complains.

operation on `context->message_id` may not be undefined

@miri64
Copy link
Member Author

miri64 commented Feb 19, 2014

@Kijewski Oh, I'll change that (it was getting late tonight).

@miri64
Copy link
Member Author

miri64 commented Feb 19, 2014

Fixed and rebased

@mehlis
Copy link
Contributor

mehlis commented Feb 24, 2014

ACK & GO

mehlis pushed a commit that referenced this pull request Feb 24, 2014
pkg : libcoap : Update libcoap version
@mehlis mehlis merged commit f437693 into RIOT-OS:master Feb 24, 2014
@OlegHahm
Copy link
Member

Does this build without gettimeofday()?

@miri64 miri64 deleted the update-libcoap branch February 25, 2014 07:06
@miri64
Copy link
Member Author

miri64 commented Feb 25, 2014

Propably not…

@OlegHahm
Copy link
Member

Then I better hurry...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants